/*
 *   Main controller
 */

angular.module('aaser.controllers').controller('AaserController', ['$rootScope', '$scope', '$location', '$base64', 'Authentication', 'UserSession', 'Authorization', 'Refresh',
    function ($rootScope, $scope, $location, $base64, Authentication, UserSession, Authorization, Refresh) {
        $scope.logout = function () {
            Authentication.cancel();

        };



        if(!UserSession.getFromCookie()){
            $scope.logout();
        }

        $scope.isLogged = function(){
          return  UserSession.user != null;
        };


        $scope.$on('event:auth-loginRequired', function () {
            Refresh();
        });




    }]);